package com.wang.tool.monitor.ops;

import com.wang.tool.monitor.core.Digest;
import com.wang.tool.monitor.core.LinkInfo;
import com.wang.tool.monitor.core.MonitorInfo;

import java.util.Arrays;
import java.util.List;

/**
 * 控制台执行环境
 *
 * @author shaopeng
 * @date 2022/10/15
 */
public class OpsContext {

    /**
     * 构造时设置
     * construct
     */
    private long rootBeginTime;
    private String group;
    private String biz;
    private String action;
    private Object[] params;
    private boolean debug;

    public OpsContext() {
    }

    public OpsContext(long rootBeginTime,String group, String biz, String action, Object[] params, boolean debug) {
        this.rootBeginTime = rootBeginTime;
        this.group = group;
        this.biz = biz;
        this.action = action;
        this.params = params;
        this.debug = debug;
    }


    /*-------------------------分割线-------------------------*/


    /**
     * 最终结果时设置
     *
     * @see MonitorInfo#stepOutMonitor
     * @see MonitorOps#fetchDetail
     */
    private Object result;
    private int cost;
    private String status;
    private boolean implicitError;
    private boolean implicitSlow;
    /**
     * 取自link的digests属性,不要修改
     *
     * @see LinkInfo#digests
     */
    private List<Digest> digests;
    /**
     * 取自link的tags属性,不要修改
     *
     * @see LinkInfo#tags
     */
    private List<String> tags;

    public long getRootBeginTime() {
        return rootBeginTime;
    }

    public void setRootBeginTime(long rootBeginTime) {
        this.rootBeginTime = rootBeginTime;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getBiz() {
        return biz;
    }

    public void setBiz(String biz) {
        this.biz = biz;
    }

    public Object[] getParams() {
        return params;
    }

    public void setParams(Object[] params) {
        this.params = params;
    }

    public boolean isDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public int getCost() {
        return cost;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }


    public List<Digest> getDigests() {
        return digests;
    }

    public void setDigests(List<Digest> digests) {
        this.digests = digests;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public boolean isImplicitError() {
        return implicitError;
    }

    public void setImplicitError(boolean implicitError) {
        this.implicitError = implicitError;
    }

    public boolean isImplicitSlow() {
        return implicitSlow;
    }

    public void setImplicitSlow(boolean implicitSlow) {
        this.implicitSlow = implicitSlow;
    }

    @Override
    public String toString() {
        return "OpsContext{" +
                "rootBeginTime=" + rootBeginTime +
                ", group='" + group + '\'' +
                ", biz='" + biz + '\'' +
                ", action='" + action + '\'' +
                ", params=" + Arrays.toString(params) +
                ", debug=" + debug +
                ", result=" + result +
                ", cost=" + cost +
                ", status='" + status + '\'' +
                ", implicitError=" + implicitError +
                ", implicitSlow=" + implicitSlow +
                ", digests=" + digests +
                ", tags=" + tags +
                '}';
    }
}
